package com.example.mall

import android.app.Application
import androidx.room.Room
import com.example.mall.database.UserDatabase


class MyApplication : Application(){
    var userDatabase : UserDatabase? = null
    var userId : Int? = null
    var cartCount : Int? = null

    override fun onCreate() {
        super.onCreate()
        userDatabase = Room.databaseBuilder(this,UserDatabase::class.java,"book")
            .addMigrations()
            .allowMainThreadQueries()
            .build()
    }

    fun getUserDB() : UserDatabase{
        return userDatabase!!
    }
}